package com.hoperun.checkcloth.util

import com.google.gson.Gson
import com.google.gson.JsonSyntaxException
import java.lang.reflect.Type

fun <T> Gson.fromJsonOrNull(json: String, type: Type): T? {
    return try {
        fromJson(json, type)
    } catch (e: JsonSyntaxException){
        null
    }
}